//
//  ZHMineCell.m
//  LoveFreshBee
//
//  Created by brice Mac on 2016/10/16.
//  Copyright © 2016年 王忠迪. All rights reserved.
//

#import "ZHMineCell.h"
#import "ZHMineModel.h"

@interface ZHMineCell ()

@property(nonatomic,weak)UIView *bottomLine;

@end

@implementation ZHMineCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:reuseIdentifier];
    
    self.selectionStyle = UITableViewCellSelectionStyleNone;
    
    [self setupUI];
    
    return self;
}


- (void)setupUI {
    UIView *bottomLine = [[UIView alloc]init];
    _bottomLine = bottomLine;
    bottomLine.backgroundColor = [UIColor grayColor];
    bottomLine.alpha = 0.3;
    self.bottomLine.frame = CGRectMake(0, self.contentView.bounds.size.height, kScreenW, 1);
    [self.contentView addSubview:bottomLine];
}


- (void)setModel:(ZHMineModel *)model {
    _model = model;
    self.imageView.image = [UIImage imageNamed:model.iconName];
    self.textLabel.text = model.title;
}



/**
 注意！⚠️当layoutSubviews方法中不调用super中的方法，会导致不能正常显示cell中的文字和图片
 */
- (void)layoutSubviews {
    [super layoutSubviews];
    self.bottomLine.frame = CGRectMake(0, self.contentView.bounds.size.height, kScreenW, 0.6);
}


- (void)awakeFromNib {
    [super awakeFromNib];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
}

@end
